package com.huawei.basic.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class AjaxResult {

    public Boolean success = true;

    public String message = "操作成功!";
    
    public static AjaxResult me(){
        return new AjaxResult();
    }
    public Object resultObj;// 用来封装额外的返回参数

    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult setMessage(String message) {
        this.message = message;
        return this;
    }

    public static AjaxResult success(){
        return new AjaxResult();
    }

    public static AjaxResult error(){
        return new AjaxResult().setSuccess(false).setMessage("系统繁忙，请重试!");
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }
}
